import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/task/process_directory_tree_entity.dart';
import 'package:get/get.dart';

class ProcessExecutionController extends GetxController {
  String? selectedId;

  final tree = <ProcessDirectoryTreeEntity>[];

  Future<void> getProcess() async {
    final resp = await HttpUtil()
        .generateGetRequest<List<ProcessDirectoryTreeEntity>>(
          '${Interface.mainBaseUrl}/process//processDirectory/tree',
        )
        .execute();
    resp.onSuccess((value) {
      final data = value.data;
      if (data != null) {
        tree.clear();
        tree.addAll(data);
      }
    });
  }

  @override
  void onInit() {
    super.onInit();
    getProcess();
  }
}
